﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PetkaWebDav.Handler.AzureBlob
{
    public static class AzureUtil
    {
        public static DateTime ConvertFromDateTimeOffset(DateTimeOffset? dateTime)
        {
            if (dateTime.Value.Offset.Equals(TimeSpan.Zero))
                return dateTime.Value.UtcDateTime;
            else if (dateTime.Value.Offset.Equals(TimeZoneInfo.Local.GetUtcOffset(dateTime.Value.DateTime)))
                return DateTime.SpecifyKind(dateTime.Value.DateTime, DateTimeKind.Local);
            else
                return dateTime.Value.DateTime;
        }
    }
}
